package day05;

public class Test06 {
    public static void main(String[] args) {
        System.out.println("Hello Test05!");
        int[] array = { 1, 2, 3, 4, 5,-5 };
        int maxNumber = getMax(array);
        System.out.println("该数组的最大值是：" + maxNumber);
    }

    public static int getMax(int[] arr) {
        int max = arr[0];
        //遍历数组 求最大值
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        // 返回最大值
        return max;
    }
}
